package com.example.jpa1.dao;


import com.example.jpa1.pojo.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StudentDao extends JpaRepository<Student,Long> {

    @Query("select s from student s where s.name like concat('%',:name,'%') ")//student的名字一定要和@Entity(name = "student")的名字一致，如果@Entity没有名字，就是类名
    List<Student> getList(@Param("name") String name);
}
